from sqlalchemy import Column, Sequence, ForeignKey
from sqlalchemy.orm import relationship
from sqlalchemy.types import Integer, String
from __init__ import Base

class Operations(Base):

    __tablename__ = "operations"

    id = Column(Integer, Sequence("operations_id_seq"), primary_key=True)
    name = Column(String(50))
    location = Column(String(100))
    owner = Column(Integer, ForeignKey('users.id'))

    operationgroup = relationship('OperationGroup')
    useroperation = relationship('UserOperation')
    commentoperation = relationship('CommentOperation')

    def __init__(self, name, location, owner):
        self.name = name
        self.location = location
        self.owner = owner

    def __repr__(self):
        return "<Operations('%s', '%s')>" % (self.name, self.location, self.owner)
